package com.zhaohang.cn.board;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
 * 作者: 赵航
 * 创建时间: 2018/8/13 16:38
 * 描述:
 */
public class ScreamReceiver extends BroadcastReceiver {
    private PrensentView mBaseActivty;
    public ScreamReceiver(PrensentView mianActivty){
        this.mBaseActivty = mianActivty;
    }
    @Override
    public void onReceive(Context context, Intent intent) {

        String action = intent.getAction();
        if (action.equals(Intent.ACTION_SCREEN_ON)) {
            System.out.println("屏幕解锁广播(即亮屏了)...");
            mBaseActivty.onScreamState(1);
        } else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
            System.out.println("屏幕加锁广播(即灭屏了)...");
            mBaseActivty.onScreamState(2);
        }


    }
}
